package com.controller;

import com.pojo.Product;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@Controller

public class ProductController {
    //@RequestMapping("/getProducts")
   // public void getProducts(String[] proIds) {
      //  for (String proId : proIds) {
         //   System.out.println("proId: " + proId);
      //  }
    //}
        @RequestMapping("/getProducts")
        public void getProducts(@RequestParam("proIds") List<String> proIds) {
            for (String proId : proIds) {
                System.out.println("proId: " + proId);
            }
        }
        @RequestMapping("/getProduct")
    public void getProduct(@RequestBody Product product) {
            System.out.println("Product.getProId()"+product.getProId());
            System.out.println("Product.getProName()"+product.getProName());
        }
        @RequestMapping("/getProductList")
    public void getProductList(@RequestBody List<Product> products) {
            for (Product product : products) {
                System.out.println("商品ID"+product.getProId());
                System.out.println("商品名称"+product.getProName());
            }
        }
}
